package com.ttc.group2.videochat.database;

import android.database.sqlite.SQLiteDatabase;
import android.provider.BaseColumns;

public class Tables {

	public static class People implements BaseColumns {
		public static final String TableName = "FriendTb";
		public static final String OwnerId = "_ownerId";
		public static final String FriendId = "_friendId";
		public static final String[] COLUMNS = { OwnerId, FriendId };

		public static void setup(SQLiteDatabase db) {
			db.execSQL(String
					.format("CREATE TABLE IF NOT EXISTS %s "
							+ "(%s INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER, %s INTEGER)",
							TableName, _ID, OwnerId, FriendId));
		}
	}

	public static class Group implements BaseColumns {
		public static final String TableName = "GroupTb";
		public static final String GroupId = "_group_Id";
		public static final String GroupName = "_group_name";
		public static final String GroupAvatar = "_group_avatar";
		public static final String[] COLUMNS = { GroupId, GroupName,
				GroupAvatar };

		public static void setup(SQLiteDatabase db) {
			db.execSQL(String
					.format("CREATE TABLE IF NOT EXISTS %s "
							+ "(%s INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER, %s TEXT NOT NULL, %s TEXT NOT NULL)",
							TableName, _ID, GroupId, GroupName, GroupAvatar));
		}
	}

	public static class Recent implements BaseColumns {
		public static final String TableName = "RecentTb";
		public static final String UserId = "_userId";
		public static final String GroupId = "_groupd_Id";
		public static final String[] COLUMNS = {UserId, GroupId };

		public static void setup(SQLiteDatabase db) {
			db.execSQL(String
					.format("CREATE TABLE IF NOT EXISTS %s "
							+ "(%s INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER, %s INTEGER)",
							TableName, _ID, UserId, GroupId));
		}
	}
}
